import request from '@/utils/request'

export function listShop(query) {
  return request({
    url: '/shop/list',
    method: 'get',
    params: query
  })
}

export function deleteShop(id) {
  return request({
    url: '/shop/delete',
    method: 'delete',
    params: { id }
  })
}

export function detailShop(id) {
  return request({
    url: '/shop/detail',
    method: 'get',
    params: { id }
  })
}

export function editShop(data) {
  return request({
    url: '/shop/update',
    method: 'put',
    data
  })
}

export function createShop(data) {
  return request({
    url: '/shop/create',
    method: 'post',
    data
  })
}


export function allForPerm(id) {
  return request({
    url: '/shop/allForPerm',
    method: 'get',
    params: { id }
  })
}

export function getLogs(query) {
  return request({
    url: '/shopLog/list',
    method: 'get',
    params: query
  })
}

export function getShopOrderList(query) {
  return request({
    url: '/shopOrder/list',
    method: 'get',
    params: query
  })
}

export function merchandiseList(query) {
  return request({
    url: '/shopOrder/merchandiseList',
    method: 'get',
    params: query
  })
}

export function shopOrderApplying(data) {
  return request({
    url: '/shopOrder/orderApplying',
    method: 'post',
    data
  })
}
// 同意
export function orderHqPass(id, remark) {
  return request({
    url: '/shopOrder/orderHqPass',
    method: 'get',
    params: { id, remark }
  })
}
// 拒绝
export function orderHqNoPass(id, remark) {
  return request({
    url: '/shopOrder/orderHqNoPass',
    method: 'get',
    params: { id, remark }
  })
}
export function shopOrderPass(id, remark) {
  return request({
    url: '/shopOrder/orderPass',
    method: 'get',
    params: { id, remark }
  })
}

export function shopOrderNoPass(id, remark) {
  return request({
    url: '/shopOrder/orderNoPass',
    method: 'get',
    params: { id, remark }
  })
}

export function shopOrderPay(data) {
  return request({
    url: '/shopOrder/orderPay',
    method: 'post',
    data
  })
}

export function shopDeliverGoods(data) {
  return request({
    url: '/shopOrder/deliverGoods',
    method: 'post',
    data
  })
}

export function shopCancelDeliverGoods(data) {
  return request({
    url: '/shopOrder/cancelDeliverGoods',
    method: 'post',
    data
  })
}

export function shopTakeDelivery(data) {
  return request({
    url: '/shopOrder/takeDelivery',
    method: 'post',
    data
  })
}

export function shopOrderDetail(id) {
  return request({
    url: '/shopOrder/read',
    method: 'get',
    params: { id }
  })
}

export function merchandiseNumber(query) {
  return request({
    url: '/merchandise/count',
    method: 'get',
    params: query
  })
}

export function shopOverview(id) {
  return request({
    url: '/shop/shopOverview',
    method: 'get',
    params: {id}
  })
}

export function purchaseApplying(data) {
  return request({
    url: '/shopOrder/purchaseApplying',
    method: 'post',
    data
  })
}

// 收货审核申请
export function acceptAudit(data) {
  return request({
    url: '/shopOrder/acceptAudit',
    method: 'post',
    data
  })
}

// 通过审核
export function passAudit(id, remark) {
  return request({
    url: '/shopOrder/passAudit',
    method: 'get',
    params: { id, remark }
  })
}

// 审核失败
export function noPassAudit(id, remark) {
  return request({
    url: '/shopOrder/noPassAudit',
    method: 'get',
    params: { id, remark }
  })
}

export function shopOps() {
  return request({
    url: '/shop/ops',
    method: 'get',
  })
}

// 店铺盘点列表
export function shopCheckList(query) {
  return request({
    url: '/shopCheck/list',
    method: 'get',
    params: query
  })
}

// 新增店铺盘点
export function shopCheckAdd(data) {
  return request({
    url: '/shopCheck/create',
    method: 'post',
    data
  })
}

// 查询盘点详情
export function shopCheckDetail(id) {
  return request({
    url: '/shopCheck/read',
    method: 'get',
    params: { id }
  })
}

// 绑定erp客户信息
export function bindErpCode(data) {
  return request({
    url: '/shop/bindErpCode',
    method: 'post',
    data
  })
}

// 复制店铺
export function shopCopy(id) {
  return request({
    url: '/shop/copy',
    method: 'get',
    params: { id }
  })
}

// 交接统计
export function settlementList(query) {
  return request({
    url: '/settlement/list',
    method: 'get',
    params: query
  })
}

// 交接详情
export function settlementDetail(id) {
  return request({
    url: '/settlement/detail',
    method: 'get',
    params: { id }
  })
}

export function shopLocations() {
  return request({
    url: '/shop/shopLocations',
    method: 'get'
  })
}

export function getShopAll() {
  return request({
    url: '/shopCheck/getShopAll',
    method: 'get'
  })
}

// 下班结算列表
export function calculateSettlementList(data) {
  return request({
    url: '/settlement/calculateSettlementList',
    method: 'get',
    params: data
  })
}

// 交接统计
export function abnormalSettlement(data) {
  return request({
    url: '/settlement/abnormalSettlement',
    method: 'get',
    params: data
  })
}
export function calculateSettlementSize(shopId) {
  return request({
    url: '/settlement/calculateSettlementSize',
    method: 'get',
    params: {shopId}
  })
}
export function abnormalSettlementSize(shopId) {
  return request({
    url: '/settlement/abnormalSettlementSize',
    method: 'get',
    params: {shopId}
  })
}

